package com.xtck.ha.system.api;


import com.xtck.ha.common.core.constant.SecurityConstants;
import com.xtck.ha.common.core.constant.ServiceNameConstants;
import com.xtck.ha.common.core.domain.R;
import com.xtck.ha.common.domain.system.api.TblAnomalyWarnings;
import com.xtck.ha.common.domain.system.api.TblTelemetryTaskInfo;
import com.xtck.ha.common.domain.system.api.analysis.*;
import com.xtck.ha.system.api.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 数据分析服务
 *
 * @author hm
 */
@FeignClient(contextId = "remoteDataAnalysisService", value = ServiceNameConstants.DATA_ANALYSIS_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteDataAnalysisService {

    /**
     * 上传文件
     *
     * @param tblAnomalyWarnings 异常告警信息
     * @return 结果
     * public AjaxResult add(@RequestBody TblAnomalyWarnings tblAnomalyWarnings)
     */
    @PostMapping(value = "/warnings")
    public R<Boolean> add(@RequestBody TblAnomalyWarnings tblAnomalyWarnings, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 处理数据
     */
    @PostMapping("/handle/compute")
    public R run(@RequestBody TblTelemetryTaskInfo taskInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/neo/addSatellite")
    public R addSatellite(@RequestBody TblSatelliteNeo tblSatelliteNeo);

    @PostMapping("/neo/addDevice")
    public R addDevice(@RequestBody TblDeviceNeo tblSatelliteNeo);

    @PostMapping("/neo/addParam")
    public R addParam(@RequestBody TblTmParamNeo tblSatelliteNeo);

    @PostMapping("/resolver/addResolver")
    public R addResolver(@RequestBody TblResolverNeo tblSatelliteNeo);

    @PostMapping("/neo/addSubSystem")
    public R addSubSystem(@RequestBody TblSubsystemNeo tblSubsystemNeo);

    @PostMapping("/neo/updateSatellite")
    public R updateSatellite(@RequestBody TblSatelliteNeo tblSatelliteNeo);

    @PostMapping("/neo/updateDevice")
    public R updateDevice(@RequestBody TblDeviceNeo tblSatelliteNeo);

    @PostMapping("/neo/updateParam")
    public R updateParam(@RequestBody TblTmParamNeo tblSatelliteNeo);

    @PostMapping("/resolver/updateResolver")
    public R updateResolver(@RequestBody TblResolverNeo tblSatelliteNeo);

    @PostMapping("/neo/updateSubSystem")
    public R updateSubSystem(@RequestBody TblSubsystemNeo tblSubsystemNeo);

    @GetMapping("warnings/generate")
    public R generate(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
